home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-08-07 | 1.5 KB | 71 lines | [TEXT/JyWs] |
- <SCRIPT LANGUAGE="JavaScript" type="text/javascript">
- <!--
-
- // ********************************************************
- time.js
-
- Time and date utilites in JavaScript.
-
- Included in the PageSpinner distribution.
- Copyright Optima System, 1997.
-
- This is an example of how to use PageSpinner Includes
- files that contains JavaScript.
-
- We will not be held responsible for any unwanted
- effects due to the usage of this script or any derivative.
- No warrantees for usability for any specific application
- are given or implied.
-
- You are free to use and modify these scripts
- if the credit above is included.
- // ********************************************************
-
- // getTime()
- // Returns: Text containing the time in the format HH:MM
-
- function getTime()
- {
- var now = new Date();
- var minutes = now.getMinutes();
- var divider = ":";
-
- if (minutes<10)
- divider = ":0";
-
- return( now.getHours() + divider + minutes );
- }
-
- function showBetween (theText, altText, startAt, stopAt)
- {
- var now = new Date();
- var h = now.getHours();
-
- if (startAt <= stopAt)
- {
- if ( h >= startAt & h <= stopAt)
- return(theText)
- else
- return (altText);
- }
- return ('** ERROR in JavaScript showBetween **');
- }
-
- function showBetween (theText, altText, startAt, stopAt)
- {
- var now = new Date();
- var h = now.getHours();
-
- if (startAt <= stopAt)
- {
- if ( h >= startAt & h <= stopAt)
- return(theText)
- else
- return (altText);
- }
- return ('** ERROR in JavaScript showBetween **');
- }
-
- // -->
- </SCRIPT>
-